// 导入请求对象
import instance from '../utils/request'


// userInfo是一个函数，并且暴露出去了
// 获取用户信息
export const userInfo  = () => {

  // 发请求
  return instance({
    url: '/v1_0/user/profile',
    method: 'get',
   
  })
}
export const editProfile =(data)=>{
  return instance({
    url:'/v1_0/user/profile',
    method:'patch',
    data
    
  })
}
export const editAvatar = (data) => {

  return instance({
      url: '/v1_0/user/photo',
      method: 'patch',
      data
  })
}
// 关注用户
export const followUser = (data) => {

  return instance({
      url: '/v1_0/user/followings',
      method: 'post',
      data
  })
}
// 取关用户
export const unfollowUser = (id) => {

  return instance({
      url: '/v1_0/user/followings/' + id,
      method: 'delete',
  })
}
//点赞
export const likings = (data) => {

  return instance({
      url: '/v1_0/article/likings',
      method: 'post',
      data
  })
}
// 取消点赞
export const unlikings = (id) => {

  return instance({
      url: '/v1_0/article/likings/' + id,
      method: 'delete',
  })
}
//不喜欢
export const dislikes = (data) => {

  return instance({
      url: '/v1_0/article/dislikes',
      method: 'post',
      data
  })
}
// 取消不喜欢
export const undislikes = (id) => {

  return instance({
      url: '/v1_0/article/dislikes/' + id,
      method: 'delete',
  })
}
